﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;

namespace Common.Protocol
{
    public class Command
    {
        public int Uid
        {
            get;
            set;
        }

        public int SeqNO
        {
            get;
            set;
        }

        public int SessionId
        {
            get;
            set;
        }

        public static T FromJson<T>(String json)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            return serializer.Deserialize<T>(json);
        }

        public String ToJson()
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            return serializer.Serialize(this);
        }

        public Command Ack()
        {
            throw new System.NotImplementedException();
        }
    }
}
